//下载express  npm i express -S
const express = require("express");

const app = express();

const port = 5005;

// 请求地址
app.get("/person", (req, res) => {
    console.log('有人请求服务器了');
  res.send({
    // 返回数据
    name: "tom",
    age: 18,
  });
});

// port 端口5005
app.listen(port, (err) => {
  if (!err) {
    console.log("服务器启动成功了！");
  } else {
    console.log(`Server running at  http://127.0.0.1:${port}`);
  }
});
